<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.3.1.js"></script>
    <script>
        $(function () {
            $('#btn1').click(function(){
                $.ajax({
                    url:'https://gitee.com/api/v5/users/tangyang8942',
                    dataType:'json',
                    success:function (res) {
                        console.log(res)
                        $('#name').text(res.name)
                        $('#avatar').attr('src',res.avatar_url)
                    }
                })
            })
            
            $('#btn2').click(function () {
                $.ajax({
                    type:'get',
                    url:'http://127.0.0.1:8080/ajax/jsonp',
                    dataType:'jsonp', // 发送jsonp请求
                    success:function (res) {
                        console.log(res)
                    }
                    
                })
            })

        })

        function handle(res) {
            console.log(res)
        }
    </script>
</head>
<body>
    <script src="http://127.0.0.1:8080/ajax/jsonp?callback=handle"></script>

    <button id="btn1">按钮1</button>
    <button id="btn2">按钮2</button>
    <hr>

    <p>
        姓名：<span id="name"></span>
    </p>
    <p>
        <img src="" id="avatar">
    </p>
</body>
</html>